package cn.yto.print.controller;

import cn.yto.print.config.i18n.I18nResourceManager;
import de.felixroske.jfxsupport.FXMLController;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.stage.StageStyle;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@FXMLController
public class BaseController {

    public final I18nResourceManager I18N = I18nResourceManager.getInstance();

    public void showAlert(String content) {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.getDialogPane().getStylesheets().add("css/alert.css");
        alert.initStyle(StageStyle.UNDECORATED);
        alert.setTitle(null);
        alert.setHeaderText(null);
        alert.setContentText(content);
        ButtonType confirmBtn = new ButtonType(I18N.get("button.alert.confirm"), ButtonBar.ButtonData.OK_DONE);
        alert.getButtonTypes().setAll(confirmBtn);
        alert.showAndWait();
    }

}
